// Author: Fadi Almasri //A program to write to a file and then read from it. #include #include using namespace std; int main() { ofstream outfile("example.txt"); outfile << "Hello, fadi!" << endl; outfile.close(); ifstream infile("example.txt"); string line; while (getline(infile, line)) { cout << line << endl; } infile.close(); return 0; }